package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.ChannelDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/*
* 敏感词业务
* */
@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveController {
    @Autowired
    private WmSensitiveService wmSensitiveService;


    /**
     * 删除敏感词
     * */
    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return wmSensitiveService.delete(id);
    }

    /**
     * 查询敏感词列表
     * */
    @PostMapping("/list")
    public ResponseResult list(@RequestBody ChannelDto dto){
        return wmSensitiveService.lists(dto);
    }

    /**
     * 保存敏感词
     * */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody WmSensitive dto){
        return wmSensitiveService.saves(dto);
    }

    /**
     * 修改敏感词
     * */
    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmSensitive dto){
        return wmSensitiveService.updates(dto);
    }
}
